class Solution {
public:
    vector<int> missingTwo(vector<int>& nums) {
        int tmp = 0;
        for (auto e : nums) tmp ^= e;
        for (int i = 1;i <= nums.size() + 2;i++) tmp ^= i;
        int a = 0, b = 0;
        int i;
        for (i = 0;i <= 31;i++)
        {
            if ((tmp >> i) & 1)
                break;
        }
        for (auto e : nums)
        {
            if ((e >> i) & 1) a ^= e;
            else b ^= e;
        }
        for (int j = 1;j <= nums.size() + 2;j++)
        {
            if ((j >> i) & 1) a ^= j;
            else b ^= j;
        }
        vector<int> v = { a,b };
        return v;


    }
};